package com.example.speeddating.exception;

import com.example.speeddating.enums.ResponseCodeEnum;

public class CommonException extends RuntimeException{

//    private ResponseCodeEnum codeEnum;

    private Integer code;

    private String message;

    public CommonException(String message, Throwable e) {
        super(message,e);
        this.message = message;
    }

    public CommonException(String message) {
        super(message);
        this.message = message;
    }

    public CommonException(Throwable e) {
        super(e);
    }

    public CommonException(ResponseCodeEnum codeEnum) {
        super(codeEnum.getMsg());
//        this.codeEnum = codeEnum;
        this.code = codeEnum.getCode();
        this.message = codeEnum.getMsg();
    }

    public CommonException(Integer code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

//    public ResponseCodeEnum getCodeEnum(){return codeEnum;}

    public Integer getCode(){return code;}

    @Override
    public String getMessage(){return message;}

    @Override
    public Throwable fillInStackTrace(){return this;}

}
